﻿@model Auction_Intranet.Models.CreateRoomModel
           
<h2>Add new room</h2>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
@*<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>*@

@using (Html.BeginForm("CreateRoom", "Admin", FormMethod.Post, new { enctype = "multipart/form-data" })){
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>CreateRoomModel</legend>

        <div class="editor-label">
            @Html.LabelFor(model => model.name)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.name)
            @Html.ValidationMessageFor(model => model.name)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.location)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.location)
            @Html.ValidationMessageFor(model => model.location)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.capacity)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.capacity)
            @Html.ValidationMessageFor(model => model.capacity)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.size)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.size)
            @Html.ValidationMessageFor(model => model.size)
        </div>

        <div class="editor-label">
            @Html.Display("Room amenities")
        </div>
        <div class="editor-field">
            @foreach (var o in Model.amenities) 
            {
              var optionValue = "myAmenities_" + o.id;                
              <input type="checkbox" 
                     id="@optionValue"
                     name="myAmenities"
                     value="@o.id"/>
              <label for="@optionValue">@o.name</label>
              <br/>
            }

@*            @Html.CheckBoxList("amenities",
                                x => x.amenities,
                                x => x.Id,
                                x => x.Name,
                                null)*@
            @Html.ValidationMessageFor(model => model.amenities)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.ImageUploaded1)
        </div>
        <div class="editor-field">
            <input name="ImageUploaded1" type="file" />
            @Html.ValidationMessageFor(model => model.ImageUploaded1)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.ImageUploaded2)
        </div>
        <div class="editor-field">
            <input name="ImageUploaded2" type="file" />
            @Html.ValidationMessageFor(model => model.ImageUploaded2)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.ImageUploaded3)
        </div>
        <div class="editor-field">
            <input name="ImageUploaded3" type="file" />
            @Html.ValidationMessageFor(model => model.ImageUploaded3)
        </div>
        
        <div class="editor-label">
            @Html.LabelFor(model => model.ImageUploaded4)
        </div>
        <div class="editor-field">
            <input name="ImageUploaded4" type="file" />
            @Html.ValidationMessageFor(model => model.ImageUploaded4)
        </div>

        <p>
            <input type="submit" value="Create" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Back", "Rooms")
</div>
